<nz-modal (nzOnCancel)="cancel()" (nzOnOk)="submit()" [(nzVisible)]="visible"
          [nzOkLoading]="submitting" nzTitle="修改密码">
  <form [formGroup]="form" class="login-form" nz-form>
    <nz-form-item>
      <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="oldPsw" nzRequired>原始密码</nz-form-label>
      <nz-form-control [nzSm]="14" [nzXs]="24">
        <input type="password" formControlName="oldPsw" id="oldPsw" nz-input>
        <nz-form-explain *ngIf="form.get('oldPsw').dirty && form.get('oldPsw').errors">
          <ng-container *ngIf="form.get('oldPsw').hasError('required')">
            请填写原始密码
          </ng-container>
        </nz-form-explain>
      </nz-form-control>
    </nz-form-item>
    <nz-form-item>
      <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="newPsw1" nzRequired>新密码</nz-form-label>
      <nz-form-control [nzSm]="14" [nzXs]="24">
        <input type="password" formControlName="newPsw1" id="newPsw1" nz-input>
        <nz-form-explain *ngIf="form.get('newPsw1').dirty && form.get('newPsw1').errors">
          <ng-container *ngIf="form.get('newPsw1').hasError('required')">
            请填写新密码
          </ng-container>
          <ng-container *ngIf="form.get('newPsw1').hasError('compareError')">
            输入不一致
          </ng-container>
        </nz-form-explain>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item>
      <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="newPsw1" nzRequired>确认新密码</nz-form-label>
      <nz-form-control [nzSm]="14" [nzXs]="24">
        <input type="password" formControlName="newPsw2" id="newPsw2" nz-input>
        <nz-form-explain *ngIf="form.get('newPsw2').dirty && form.get('newPsw2').errors">
          <ng-container *ngIf="form.get('newPsw2').hasError('required')">
            请确认密码
          </ng-container>
          <ng-container *ngIf="form.get('newPsw2').hasError('compareError')">
            输入不一致
          </ng-container>
        </nz-form-explain>
      </nz-form-control>
    </nz-form-item>
  </form>
</nz-modal>
